################################
#
#     Makefile PRIMO ASSEGNAMENTO AA 2018/19
#    
################################


# file da consegnare
# modificare se si aggiungono file
FILE_DA_CONSEGNARE=shipbat.c

# preferenze compilatore e flag di compilazione
CC=gcc
# compilazione 
CFLAGS= -Wall -pedantic -g

obj = shipbat.o shipbat_d.o

# phony targets
.PHONY: cleanall test1 test2 test3 consegna 


shipbat1 : 01test.o $(obj)
	gcc $(obj) 01test.o -o shipbat1 -lm

shipbat2 : 02test.o $(obj)
	gcc $(obj) 02test.o -o shipbat2 -lm

shipbat3 : 03test.o $(obj)
	gcc $(obj) 03test.o -o shipbat3 -lm




shipbat.o: shipbat.c shipbat.h  
shipbat_d.o: shipbat_d.c shipbat.h  
01test.o: 01test.c shipbat.h   
02test.o: 02test.c shipbat.h   



cleanall: 
	-rm -f *.o *~ ./core shipbat?


test1:
	make cleanall
	make shipbat1
	./shipbat1 
	@echo "********** Test1 superato!"

test2: 
	make cleanall
	make shipbat2
	./shipbat2 
	@echo "********** Test2 superato!"

test3: 
	make cleanall
	make shipbat3
	./shipbat3
	@echo "********** Test3 superato!"


consegna:
	make cleanall
	make test1
	make test2
	make test3
	./gruppo-check.pl < gruppo.txt
	tar -cvf $(USER)-a1.tar ./gruppo.txt  $(FILE_DA_CONSEGNARE) 
	@echo "********** TAR creato inviare in allegato a una mail al docente del proprio corso insieme a nome, cognome,  numero di matricola dei componenti del gruppo"
